
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>The MathJax.OutputJax Class &mdash; MathJax v1.0 documentation</title>
    <link rel="stylesheet" href="../_static/mj.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="top" title="MathJax v1.0 documentation" href="../index.html" />
    <link rel="up" title="The MathJax API" href="index.html" />
    <link rel="next" title="The MathJax.ElementJax Class" href="elementjax.html" />
    <link rel="prev" title="The MathJax.InputJax Class" href="inputjax.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="elementjax.html" title="The MathJax.ElementJax Class"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="inputjax.html" title="The MathJax.InputJax Class"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">MathJax v1.0 documentation</a> &raquo;</li>
          <li><a href="index.html" accesskey="U">The MathJax API</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="the-mathjax-outputjax-class">
<span id="api-output-jax"></span><h1>The MathJax.OutputJax Class<a class="headerlink" href="#the-mathjax-outputjax-class" title="Permalink to this headline">¶</a></h1>
<p>Output jax are the components of MathJax that translate
mathematics from the MathJax internal format (an <cite>element jax</cite>)
to whatever output is required to represent the mathematics (e.g.,
MathML elements, or HTML-with-CSS that formats the mathematics on screen).</p>
<p>An output jax is stored as a pair of files in a subdirectory of the
the <tt class="docutils literal"><span class="pre">jax/output</span></tt> directory, with the subdirectory name being the
name of the output jax.  For example, the NativeMML output jax is
stored in <cite>jax/output/NativeMML</cite>.  The first file, <tt class="docutils literal"><span class="pre">config.js</span></tt>, is
loaded when MathJax is being loaded and configured, and is indicated
by listing the input jax directory in the <cite>jax</cite> array of the MathJax
configuration.  The <tt class="docutils literal"><span class="pre">config.js</span></tt> file creates a subclass of the
<cite>MathJax.OutputJax</cite> object for the new output jax and registers it
with MathJax, along with the MIME-type of the element jax that it can
process.</p>
<p>The main body of the output jax is stored in the second file, <tt class="docutils literal"><span class="pre">jax.js</span></tt>,
which is loaded when the output jax is first called on to translate
some mathematics.  This file augments the original output jax
subclass with the additional methods needed to produce the output.
MathJax calls the input jax&#8217;s <a class="reference internal" href="jax.html#Translate" title="Translate"><tt class="xref py py-meth docutils literal"><span class="pre">Translate()</span></tt></a> method when it needs
the output jax to translate an element jax to produce output.</p>
<p>The <cite>MathJax.OutputJax</cite> class is a subclass of the <a class="reference internal" href="jax.html#api-jax"><em>MathJax Jax</em></a> class, and inherits the properties and methods of that
class.  Those listed below are the additional or overridden ones from
that class.</p>
<div class="section" id="properties">
<h2>Properties<a class="headerlink" href="#properties" title="Permalink to this headline">¶</a></h2>
<dl class="describe">
<dt>
<tt class="descname">name</tt></dt>
<dd><p>The name of the jax.</p>
</dd></dl>

<dl class="describe">
<dt>
<tt class="descname">version</tt></dt>
<dd><p>The version number of the jax.</p>
</dd></dl>

<dl class="describe">
<dt>
<tt class="descname">directory</tt></dt>
<dd><p>The directory where the jax files are stored (e.g., <tt class="docutils literal"><span class="pre">&quot;[MathJax]/jax/output/HTML-CSS&quot;</span></tt>);</p>
</dd></dl>

</div>
<div class="section" id="methods">
<h2>Methods<a class="headerlink" href="#methods" title="Permalink to this headline">¶</a></h2>
<dl class="method">
<dt>
<tt class="descname">Translate</tt><big>(</big><em>script</em><big>)</big></dt>
<dd><p>This is the main routine called by MathJax when an element jax is
to be converted to output.  The default <a class="reference internal" href="jax.html#Translate" title="Translate"><tt class="xref py py-meth docutils literal"><span class="pre">Translate()</span></tt></a>
method simply loads the <tt class="docutils literal"><span class="pre">jax.js</span></tt> file and returns that callback
for that load function so that MathJax will know when to try
the <a class="reference internal" href="jax.html#Translate" title="Translate"><tt class="xref py py-meth docutils literal"><span class="pre">Translate()</span></tt></a> action again.  When the <tt class="docutils literal"><span class="pre">jax.js</span></tt> file
loads, it should override the default <a class="reference internal" href="jax.html#Translate" title="Translate"><tt class="xref py py-meth docutils literal"><span class="pre">Translate()</span></tt></a> with its
own version that does the actual translation; that way, when the
second Translate call is made, it will be to the actual
translation routine rather than the default loader.</p>
<p>You should use <tt class="docutils literal"><span class="pre">MathJax.Hub.getJaxFor(script)</span></tt> to obtain the
element jax for the given script.  The translation process may add
modify the element jax (e.g., if it has data that needs to be
stored with the jax), and may insert DOM elements into the
document near the jax&#8217;s <tt class="docutils literal"><span class="pre">&lt;script&gt;</span></tt> tag.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters :</th><td class="field-body"><ul class="first simple">
<li><strong>script</strong>  &#8212; the <tt class="docutils literal"><span class="pre">&lt;script&gt;</span></tt> element to be translated</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns :</th><td class="field-body"><p class="first last">the <cite>element jax</cite> resulting from the translation</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt>
<tt class="descname">Register</tt><big>(</big><em>mimetype</em><big>)</big></dt>
<dd><p>This registers the MIME-type for the element jax associated with
this output jax so that MathJax knows to call this jax when it
wants to display an element jax of that type.  Several output jax
may register for the same input jax, in which case the first one
to register will be the default one for that type.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters :</th><td class="field-body"><ul class="first simple">
<li><strong>mimetype</strong> &#8212; the MIME-type of the input this jax processes</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns :</th><td class="field-body"><p class="first last"><tt class="docutils literal"><span class="pre">null</span></tt></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt>
<tt class="descname">Remove</tt><big>(</big><em>jax</em><big>)</big></dt>
<dd><p>Removes the output associated with the given element jax.  The
routine can use <tt class="docutils literal"><span class="pre">jax.SourceElement()</span></tt> to locate the <tt class="docutils literal"><span class="pre">&lt;script&gt;</span></tt>
tag associated with the element jax.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters :</th><td class="field-body"><ul class="first simple">
<li><strong>jax</strong> &#8212; the element jax whose display should be removed</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns :</th><td class="field-body"><p class="first last"><tt class="docutils literal"><span class="pre">null</span></tt></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">The MathJax.OutputJax Class</a><ul>
<li><a class="reference internal" href="#properties">Properties</a></li>
<li><a class="reference internal" href="#methods">Methods</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="inputjax.html"
                        title="previous chapter">The MathJax.InputJax Class</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="elementjax.html"
                        title="next chapter">The MathJax.ElementJax Class</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/api/outputjax.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="elementjax.html" title="The MathJax.ElementJax Class"
             >next</a> |</li>
        <li class="right" >
          <a href="inputjax.html" title="The MathJax.InputJax Class"
             >previous</a> |</li>
        <li><a href="../index.html">MathJax v1.0 documentation</a> &raquo;</li>
          <li><a href="index.html" >The MathJax API</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2010 Design Science.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.4.
    </div>
  </body>
</html>